// function(browser) {} and browser => {} do the same
const customButton = "input#amount-custom"
const customText = "#choice-buttons > div > p"

module.exports = {
    // all tests are disabled
    '@disabled': false,
    beforeEach: function (browser) {
        browser.url("https://elementary.io/")
    },
    afterEach: function (browser) {
        browser.end();
    },

    "Purchase elementary os": function (browser) {
        browser.useCss() // default "use css selector"
            .maximizeWindow()
            // browser.useXpath()
            .click(customButton)
            .assert.textContains(customText, "Enter any dollar amount.", "\"Enter any dollar amount\" text is present")
    },

    "Navigate to the support page": browser => {
        browser.click('a[href="/support"]')
            .assert.title("Support ⋅ elementary")
            .assert.urlContains('support');
    }
};